<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>OSS web直传</title>
    <link rel="stylesheet" type="text/css" href="/common/oss_upload/style.css"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <style>
        #container{
            width:100%;
            text-align: center;
        }

        #ossfile,.progress{
            width:100%;
        }

        #ossfile{
            /*margin-top:10px;*/
        }
    </style>
</head>
<body>

<form name=theform>
    <!--<input type="radio" name="myradio" value="local_name" checked=true/> 上传文件名字保持本地文件名字-->
    <!--<input type="hidden" name="myradio" value="random_name"  />-->
    <input type="hidden" id='dirname' value="{$dir}" placeholder="如果不填，默认是上传到根目录" size=50>
</form>

<div id="container">
    <a id="selectfiles" href="javascript:void(0);" class='btn'>添加文件</a>
    <a id="postfiles" href="javascript:void(0);" class='btn'>开始上传</a>
</div>
<h4>您所选择的文件列表：</h4>
<div id="ossfile">你的浏览器不支持flash,Silverlight或者HTML5！</div>

<br/>


<pre id="console"></pre>

<p>&nbsp;</p>

</body>
<script type="text/javascript" src="/js/jquery.js"></script>
<!--<script type="text/javascript" src="/backstage/lib/layui/layui.js"></script>-->

<script type="text/javascript" src="/common/oss_upload/lib/crypto1/crypto/crypto.js"></script>
<script type="text/javascript" src="/common/oss_upload/lib/crypto1/hmac/hmac.js"></script>
<script type="text/javascript" src="/common/oss_upload/lib/crypto1/sha1/sha1.js"></script>
<script type="text/javascript" src="/common/oss_upload/lib/base64.js"></script>
<script type="text/javascript" src="/common/oss_upload/lib/plupload-2.1.2/js/plupload.full.min.js"></script>
<script type="text/javascript" src="/common/oss_upload/upload.js?v=12"></script>

<script>

    success_num =0;
    function uploadSuccess(file_name,file_path){

        success_num ++;
        var data = {
            folder_id:'{$folder_id}',
            file_name:file_name,
            file_path:file_path,
            type:'{$type}'
        }

        $.post('{:url("webUpload")}',data,function(res){

            if(success_num==file_num){
                parent.app.getListData();
                var index = parent.layer.getFrameIndex(window.name);
                //关闭当前frame
                parent.layer.close(index);
                parent.layer.msg("上传成功", {icon: 1, time: 1200});

            }
        })

    }
</script>
</html>
